home *** CD-ROM | disk | FTP | other *** search
- Path: duck.ibh-dd.de!beck
- From: beck@duck.ibh-dd.de (Andre Beck)
- Newsgroups: comp.lang.c
- Subject: Who's dumb: Summary
- Date: 15 Feb 1996 11:39:26 GMT
- Organization: IBH - Xlink PoP Dresden
- Message-ID: <4fv61e$mho@micky.ibh-dd.de>
- NNTP-Posting-Host: duck.ibh-dd.de
- X-Newsreader: TIN [version 1.2 PL1]
-
- Hi,
-
- thanks to all who replied to me regarding my problem
-
- x = (*dat++ << 8) | *dat++;
-
- It turns out to be _ME_ who is dumb in the given case, because I
- didn't know about the subtle issue of sequence points in C. The
- above expression has two evaluations with side effects in one line,
- but this gives a sequence point - a point where all side effects
- need to be evaluated - for each of them. This can be done by splitting
- the expression in two lines. With the above expression, it is really
- legitimate for the compiler to optimize in the way I observed.
-
- References:
- The FAQ of comp.lang.c (seems I should have read it before...)
- ANSI/ISO 9899-1990 section 6.3 and Annex C
-
- I'm going to change some code now,
- Thanks, Andre.
- --
- +-o-+--------------------------------------------------------+-o-+
- | o | \\\- Brain Inside -/// | o |
- | o | ^^^^^^^^^^^^^^ | o |
- | o | Andre' Beck (ABPSoft) beck@ibh-dd.de XLink PoP Dresden | o |
- +-o-+--------------------------------------------------------+-o-+
-